// @ts-nocheck
import { defineStore } from 'pinia'
export const webSocketStore = defineStore('webSocket', {
  // 为了完整类型推理，推荐使用箭头函数
  state: () => {
    return {
      // 所有这些属性都将自动推断出它们的类型
      wsInstance: null,
      message: {}
    }
  },
  actions: {
    setInstance(instance: WebSocket | null) {
      this.wsInstance = instance
    },
    setMessage(message: any) {
      this.message = message
    },
    sendMessage(message: any) {
      this.wsInstance.send(message)
    }
  }
})
